#include<bits/stdc++.h>
using namespace std;
long long n,a,b,c,dp[200005][3];
int main(){
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d%d%d",&a,&b,&c);
		dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a;
		dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b;
		dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c;
	}
	cout<<max(max(dp[n][0],dp[n][1]),dp[n][2]);
	return 0;
} 
